home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / tool_inc.zip / GIVETIME.INC < prev    next >
Text File  |  1989-08-29  |  2KB  |  80 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * this procedure should be called often inside the "nothing to do" loop when
  15.  * the system has nothing to do (eg. waiting for a host mode call; no rx/tx
  16.  * activity when online; sitting at a dialing directory prompt; etc.)
  17.  *
  18.  *)
  19.  
  20.  
  21. procedure determine_tasker;
  22.    {determine what multi-tasker is active, if any}
  23. var
  24.    reg:  registers;
  25.  
  26. begin
  27.    reg.bx := 0;
  28.    reg.ax := $1022;     {get topview/taskview version}
  29.    intr($15,reg);
  30.    tasker := taskview;
  31.    if reg.bx <> 0 then
  32.    begin
  33.       directVideo := false;
  34.       exit;
  35.    end;
  36.  
  37.    reg.ax := $e400;     {return current program status, doubledos}
  38.    msdos(reg);
  39.    tasker := doubledos;
  40.    if (reg.al = 1) or (reg.al = 2) then
  41.       exit;
  42.  
  43.    {cannot detect a multi-tasker, disable give-up-time calls}
  44.    tasker := notasker;
  45. end;
  46.  
  47.  
  48. (* ------------------------------------------------------------ *)
  49. procedure give_up_time;
  50.    {give up unused time under doubledos}
  51. var
  52.    reg:  registers;
  53.  
  54. begin
  55.  
  56. {WRITE('`3');}
  57.    {determine what multi-tasker is active, if any}
  58.    if tasker = unknown then
  59.       determine_tasker;
  60.    
  61.    {give up time with taskview/omniview/topview}
  62.    if tasker = taskview then
  63.    begin
  64.       reg.ax := $1000;          {give up remainder of timeslice}
  65.       intr($15,reg);
  66.    end
  67.    else
  68.  
  69.    {give up time with doubledos}
  70.    if tasker = doubledos then
  71.    begin
  72.       reg.ax := $0001;           {give up 1 clock tick/slice}
  73.       intr($fe,reg);
  74.    end;
  75.  
  76. {WRITE('`4');}
  77. end;
  78.  
  79.  
  80.